package com.base.interceptor;

import com.base.controller.BaseController;
import com.jfinal.aop.Interceptor;
import com.jfinal.core.ActionInvocation;
import com.jfinal.core.Controller;

public class ModelNameInterceptor implements Interceptor {

	@Override
	public void intercept(ActionInvocation ai) {
		Controller c = ai.getController();
		if (c instanceof BaseController && ((BaseController) c).getModelName() != null) {
			c.setAttr("bean", ((BaseController) c).getModelName());
		}
		ai.invoke();
	}

}
